package cn.dylan.oneway;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class OnewayProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("oneway_producer_group");
        producer.setNamesrvAddr("localhost:9876");

        producer.start();

        Message message = new Message("oneway","hi","我不愿当牛马".getBytes(StandardCharsets.UTF_8));
        // 发送一次信息
        producer.sendOneway(message);
        // 关闭服务
        producer.shutdown();
    }
}
